<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="application/rdf+xml; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  

<%@page import="net.groupme.api.ontology.GroupMeOntology"%>
<%@page import="net.groupme.api.ontology.FOAFOntology"%>
<%@page import="net.groupme.api.ontology.TagOntology"%>
<rdf:RDF
    xmlns="<%= GroupMeOntology.NS %>"
    xmlns:foaf="<%= FOAFOntology.NS %>"
    xmlns:dct="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:skos="http://www.w3.org/2004/02/skos/core"
    xmlns:tag="<%= TagOntology.NS %>"
  xml:base="<%= GroupMeOntology.BASE %>">

<tag:<%= TagOntology.TAG %> rdf:about="<c:out value="${tag.URI}"/>">
  <tag:<%= TagOntology.NAME%>><c:out value="${tag.keyword}"/></tag:<%= TagOntology.NAME%>>
  <dc:title><c:out value="${tag.keyword}"/></dc:title>
   <c:forEach items="${tag.resources}" var="resource" varStatus="status">
     <tag:<%= TagOntology.IS_TAG_OF %>> 
     <c:choose><c:when test="${resource.type == 'group'}"><<%= GroupMeOntology.GROUP %> rdf:about="<c:out value="${resource.URI}"/>"></c:when><c:otherwise><<%= FOAFOntology.DOCUMENT %> rdf:about="<c:out value="${resource.URI}"/>"></c:otherwise></c:choose>
       <c:forEach items="${resource.tags}" var="t" varStatus="stat">
         <tag:<%= TagOntology.TAGGED_WITH_TAG %> rdf:resource="<c:out value="${t.URI}"/>"/>
       </c:forEach>
     <c:choose><c:when test="${resource.type == 'group'}"></<%= GroupMeOntology.GROUP %>></c:when><c:otherwise></<%= FOAFOntology.DOCUMENT %>></c:otherwise></c:choose>
     </tag:<%= TagOntology.IS_TAG_OF %>>
   </c:forEach>
   <<%= GroupMeOntology.GROUPME_SEARCH_RESULT %>>
     <skos:OrderedCollection>
        <rdfs:label>GroupMe! search result for <c:out value="${tag.keyword}"/></rdfs:label>
        <dc:title>GroupMe! search result for <c:out value="${tag.keyword}"/></dc:title>
        <rdfs:comment>The (ranked) GroupMe! search result list also contains resources, which are not directly tagged with '<c:out value="${tag.keyword}"/>', but are contained in a group, which is related with '<c:out value="${tag.keyword}"/>'.</rdfs:comment>
        <skos:memberList rdf:parseType="Collection">
          <c:forEach items="${searchResultList}" var="resource" varStatus="status">
            <c:choose><c:when test="${resource.type == 'group'}"><<%= GroupMeOntology.GROUP %> rdf:about="<c:out value="${resource.URI}"/>"></c:when><c:otherwise><<%= FOAFOntology.DOCUMENT %> rdf:about="<c:out value="${resource.URI}"/>"></c:otherwise></c:choose>
              <c:forEach items="${resource.tags}" var="t" varStatus="stat">
                <tag:<%= TagOntology.TAGGED_WITH_TAG %> rdf:resource="<c:out value="${t.URI}"/>"/>
       		  </c:forEach>
		    <c:choose><c:when test="${resource.type == 'group'}"></<%= GroupMeOntology.GROUP %>></c:when><c:otherwise></<%= FOAFOntology.DOCUMENT %>></c:otherwise></c:choose>
          </c:forEach>
        </skos:memberList>
     </skos:OrderedCollection>
   </<%= GroupMeOntology.GROUPME_SEARCH_RESULT %>>
  
</tag:<%= TagOntology.TAG %>>
</rdf:RDF>